--- import type { Page, GetStaticPathsOptions } from "astro"; import type { CollectionEntry } from "astro:content"; import { getCollection } from "astro:content"; import PageLayout from "@/layouts/Base"; import PostPreview from "@/components/blog/PostPreview"; import Pagination from "@/components/Paginator"; import { getUniqueTags, sortMDByDate } from "@/utils"; export async function getStaticPaths({ paginate }: GetStaticPathsOptions) { const allPosts = await getCollection("post"); const allPostsByDate = sortMDByDate(allPosts); const uniqueTags = getUniqueTags(allPosts); return paginate(allPostsByDate, { props: { uniqueTags }, pageSize: 10 }); } interface Props { page: Page>; uniqueTags: string[]; } const { page, uniqueTags } = Astro.props; const meta = { title: "Posts", description: "A collection of posts by me for an Asto starter theme", }; const paginationProps = { ...(page.url.prev && { prevUrl: { url: page.url.prev, text: `← Previous Posts`, }, }), ...(page.url.next && { nextUrl: { url: page.url.next, text: `Next Posts →`, }, }), }; ---

Posts

    { page.data.map((p) => (
  • )) }
{ uniqueTags.length && ( ) }